try {
	Type.registerNamespace('NCMMPubMenu');
	//参数displaySD - 是否显示扫描记录菜单
	NCMMPubMenu.openDropDownList = function(controlid, displaySD) {
		var jsonDownList = {
			"controlid": controlid, //目标控件的id
			"dropDownListWidth": "100", //菜单项的宽度
			"background": "#f2f2f2",
			//"background-image":"app.png",
			"color": "#ee4311",
			"font-size": "12",
			"halign": "center", //right  center
			"split-color": "#ee4311",
			//"margin-left":"10",
			"panelstyle": "round-div",
			"border-color": "#ee4311",
			//"showtype":"right",
			"dropItemsArray": [{
				"id": "id_homepage",
				"name": "主界面", //菜单项名称
				"action": "gotohomepage()" //点击该菜单项时执行的JS方法
			}, {
				"id": "id_datamanage",
				"name": "数据管理", //菜单项名称
				"action": "gotodatamanage()" //点击该菜单项时执行的JS方法
			}, {
				"id": "id_setting",
				"name": "业务设置", //菜单项名称
				"action": "setting()" //点击该菜单项时执行的JS方法
			}, {
				"id": "id_logout",
				"name": "注销", //菜单项名称
				"action": "logout()" //点击该菜单项时执行的JS方法
			}]
		};

		if(displaySD && displaySD == true) {
			var item = {
				"id": "id_scanrecord",
				"name": "扫描记录", //菜单项名称
				"action": "showScanList()" //点击该菜单项时执行的JS方法
			};
			(jsonDownList["dropItemsArray"]).push(item);
		}

		$menu.openDropDownList(jsonDownList);
	};

	NCMMPubMenu.rightFlipper = function(flipperparam) {
		var rightflipper = new Array();
		for(var i = 0; i < flipperparam.length; i++) {
			//			$alert("flipperparam="+$jsonToString(flipperparam[i]));
			rightflipper.push(NCMMPubMenu.getAllFlipperparam(flipperparam[i]));
		}

		return rightflipper;
	};

	NCMMPubMenu.getAllFlipperparam = function(jsonparam) {
		//		$alert("jsonparam="+$jsonToString(jsonparam));
		var jsonret = {
			"halign": "center",
			"text-align": "right",
			"width": "70",
			"height": jsonparam["height"],
			"icon-width": "12",
			"istogglebutton": "false",
			"font-pressed-color": "#ffffff",
			"icon-height": "12",
			"height": "59",
			"color": "#ffffff",
			"layout-type": "linear",
			"background": jsonparam["background"],
			"font-size": "12",
			"icon-background-image": "audit_refuse.png",
			"value": jsonparam["name"],
			"icon-pressed-image": "audit_refuse.png",
			"font-family": "default",
			"valign": "center",
			"checked": "false",
			"icon-text-spacing": "8",
			"onclick": jsonparam["afterclick"]
		};

		return jsonret;
	}

	NCMMPubMenu.getFilipperBtnParam = function(btnname, btnbackground, btnfun) {
		var btnparam = {};
		btnparam["name"] = btnname;
		btnparam["background"] = btnbackground;
		btnparam["afterclick"] = btnfun;
		return btnparam;
	}

	function gotohomepage() {
		$view.open({
			"viewid": "com.yonyou.ncmm_pac_pda.HomePage", //目标页面（首字母大写）全名
			"isKeep": "true", //打开新页面的同时是否保留当前页面，true为保留，false为不保留
		});
	}

	function gotodatamanage() {
		$view.open({
			"viewid": "com.yonyou.ncmm_pac_pda.DM_main", //目标页面（首字母大写）全名
			"isKeep": "true", //打开新页面的同时是否保留当前页面，true为保留，false为不保留
		});
	}

	function setting() {
		$view.open({
			"viewid": "com.yonyou.ncmm_pac_pda.BusinessSettingPage", //目标页面（首字母大写）全名
			"isKeep": "true", //打开新页面的同时是否保留当前页面，true为保留，false为不保留
		});
	}

	function logout() {
		//$view.close();
		$view.open({
			"viewid": "com.yonyou.ncmm_pac_pda.LoginPage", //目标页面（首字母大写）全名
			"isKeep": "false", //打开新页面的同时是否保留当前页面，true为保留， false为不保留
		});
	}

} catch(e) {
	$e(e);
}